<template>
	<view style="padding: 15px;min-height:calc(100vh);">
		<p style="font-size: 18px;">{{data.title}}</p>
		<p style="font-size: 14px;color: #868686;margin: 5px 0 10px 0;">{{$u.timeFormat(data.time, 'yyyy-mm-dd')}}</p>
		<editor id="editor" style="height: 100%;" read-only @ready="onEditorReady(data.content)"></editor>
	</view>
</template>

<script>
	export default {
		props: {
			data: {
				type: Object,
				default (data) {
					return {}
				}
			}
		},
		name:"document",
		methods:{
			onEditorReady(data){
				uni.createSelectorQuery().select('#editor').context((res) => {
				res.context.setContents({html:data})
				}).exec()
			}
		}
	}
</script>

<style type="less">
page{
	background-color: white;
}
</style>